Using CSL logic in your mappings

It is not necessary for the value of the CAD property to exactly match an available value of an aPriori field. For example, the CAD field COMMODITY with a value of Casting could be mapped to the Casting – Die process group in aPriori .

The availability of CSL expressions in the mapping file also means that the value of the aPriori field can be driven based on the value of multiple CAD fields as well as just a single CAD field.  For example, the aPriori Digital Factory may be chosen based on the values of both the PRODUCTION_REGION and TOOLING_REGION CAD fields.

For a brief introduction to CSL, see the CSL Overview section of the chapter "Working with Cost Model Logic" in the aPriori Professional Cost Model Workbench Guide. See also the chapter "Cost Scripting Language Reference" in the same Guide.

Basic examples of CSL logic

The following snippets show some simple examples of the capability to embed CSL logic into your mapping file. The first example shows a commented-out simple mapping between the Creo® COMMODITY property and the aPriori Process Group production input. It has been replaced by a CSL expression that checks whether COMMODITY is set to "Casting". If it is, the aPriori Process Group is set to Casting – Die. If not, the Process Group is set to Plastic Molding.

 

A more complex CSL expression is used to determine the correct aPriori Digital Factory based on the value of the Creo PRODUCTION_LOCATION property:

CSL cannot directly access the value of named properties, so the <source> tag also includes an id attribute that CSL uses. The PRODUCTION_LOCATION property may be one of several cities, so the CSL code evaluates whether the city is in the United States or China and picks the correct Digital Factory for that region. As a back-up, if neither region is recognized, the "aPriori Mexico" Digital Factory is chosen.